package com.whz.workmanageol.dao;

import com.whz.workmanageol.entity.Student;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

@Repository
public interface StudentMapper extends Mapper<Student> {
    @Update("update student set gradeid = (select id from grade where gradename = #{gradename}) where studentid = #{studentid}")
    void saveGradeid(String studentid, String gradename);

    @Select("select id from student where studentid = #{studentid}")
    String findIDByStudentid(String studentid);

    @Update("update student set email = #{email} where id = #{id}")
    void updateEmailByID(String id, String email);

    @Update("update student set tel = #{tel} where id = #{id}")
    void updateTelByID(String id, String tel);

    @Update("update student set password = #{password} where id = #{id}")
    void updatePasswordByID(String id, String password);

    List<Student> selectStuByGradeid(String gradeid);
}
